<%@ include file="/WEB-INF/common/taglibs.jsp"%>
<%@ page import="com.oss.service.system.CacheService"%>
<%
	request.setAttribute("rootTags", CacheService.getRootTags());
%>
<h2><c:choose>
	<c:when test="${tag.new}">Add Tag</c:when>
	<c:otherwise>Update Tag:${tag.name}</c:otherwise>
</c:choose></h2>

<form:form modelAttribute="tag">
	<table class="editTable">
		<tr>
			<th><c:if test="${tag.new}">Id: <form:errors path="id"
					cssClass="errors" />
				<br />
				<form:input path="id" size="40" maxlength="128" />
			</c:if></th>
		</tr>
		<tr>
			<th>Name: <form:errors path="name" cssClass="errors" /> <br />
			<form:input path="name" size="40" maxlength="128" /></th>
		</tr>
		<tr>
			<th>Description: <form:errors path="description"
				cssClass="errors" /> <br />
			<form:textarea path="description" rows="10" cols="60" /></th>
		</tr>
		<tr>
			<th>Parent Tag: <form:errors path="parent" cssClass="errors" />
			<br />
			<form:select path="parent">
				<c:forEach var="item" items="${rootTags}">
					<c:choose>
						<c:when test="${tag.parent eq item.id}">
							<option value="${item.id}" label="${item.name}" selected />
						</c:when>
						<c:otherwise>
							<option value="${item.id}" label="${item.name}" />
						</c:otherwise>
					</c:choose>
				</c:forEach>
				<form:option value="" label="--------" />
				<form:option value="0" label="Root Tag" />
			</form:select></th>
		</tr>
		<tr>
			<td><c:choose>
				<c:when test="${tag.new}">
					<p class="submit"><input type="submit" value="Add" />&nbsp; <input
						type="reset" value="Reset" /></p>
				</c:when>
				<c:otherwise>
					<p class="submit"><input type="submit" value="Update" />&nbsp;
					<input type="reset" value="Reset" /></p>
				</c:otherwise>
			</c:choose></td>
		</tr>
	</table>
</form:form>
